#include "Stdafx.h"
#include "ShaderVariable.h"

namespace WindGE
{
	ShaderVariable::ShaderVariable()
		: reflection_cbuffer_(nullptr)
		, reflection_variable_(nullptr)
		, reflection_variable_type_(nullptr)
	{
	}

	ShaderVariable::~ShaderVariable()
	{
	}

	bool ShaderVariable::create(ID3D11ShaderReflectionConstantBuffer* reflCBuffer, 
		ID3D11ShaderReflectionVariable* reflVariable, void* buffData)
	{
		reflection_cbuffer_ = reflCBuffer;
		reflection_variable_ = reflVariable;

		HRESULT hr = reflection_variable_->GetDesc(&variable_desc_);
		if (FAILED(hr)) return false;

		reflection_variable_type_ = reflection_variable_->GetType();
		hr = reflection_variable_type_->GetDesc(&varible_type_desc_);
		if (FAILED(hr)) return false;

		return true;
	}

}//end namespace WindGE


